package rabbitcore.rabbit.TimeOutQueue;

import org.springframework.stereotype.Component;
import rabbitcore.rabbit.utils.PauseUtil;

import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;

/**
 * @author 一杯咖啡
 * @desc
 * @createTime 2018-12-20-0:39
 */
@Component
public class ProProducer extends MsgProducer<News> {


    public void handleMsg() {
        int count = 1;
        while (true) {
            News news = new News();
            news.setId(1L);
            news.setAuthor("zxx" + count);
            news.setTitle("这是标题" + count);
            news.setContent("dasdasdasdasdasdwvsd" + count);
            news.setSource("四川" + count);
            news.setTime(LocalDateTime.now());
            this.sendMsg(news, TimeUnit.SECONDS, 1);
            count++;
            PauseUtil.pause(1,0);
        }
    }
}


